package com.xmhmyh.generalframework.common.utils;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

/**
 * @Author: 于丁
 * @DateTime: 2021/1/20 2:23 下午
 */
public class LocalDateUtils {

    public static String LocalDate2String(LocalDate localDate, String pattern) {
        if (localDate == null || StringUtils.isBlank(pattern)) {
            return null;
        }
        return localDate.format(DateTimeFormatter.ofPattern(pattern));
    }

    public static LocalDate String2LocalData(String time, String pattern) {
        if (StringUtils.isBlank(time) || StringUtils.isBlank(pattern)) {
            return null;
        }
        return LocalDate.parse(time, DateTimeFormatter.ofPattern(pattern));
    }
}
